The Sleep State
The Sleep State
The Operating System sends a sleep command to the Power Manager when
the user requests it (through the Battery desk accessory or the Finder), when
the battery voltage falls below a preset level, or when the system has
remained inactive for an amount of time that the user sets through the Por table
control panel.
The Operating System uses the Power Manager to shut down power to the
CPU, the ROM, and some of the control logic. Sufficient power is maintained to
the RAM so that no data is lost. Before the Operating System sends the sleep
command to the Power Manager, it performs the following tasks:
It pushes the contents of all of the CPU's internal registers onto the
stack.
It calls all routines listed in the sleep queue to inform them that the
system is about to be put into the sleep state. These routines include the
device drivers for the serial ports and floppy disk drives. Each device
driver must call the Power Manager to stop power or clocks to the
peripheral device controlled by that driver. If the device contains any
internal registers, the device driver must save their contents before
turning off power to the device. See The Sleep Queue for further
information.
It pushes onto the stack the Reset vector, the contents of the versatile
interface adapter (VIA) chip, and the contents of the Apple Sound Chip
(ASC) control registers.
It saves the stack pointer in memory.
While the Macintosh Portable computer is in the sleep state, the clock to the
Power Manager is off so that the chip does no processing. On each rising
edge of the 60 Hz clock signal (from one of the Macintosh Portable computer's
logic chips), a hardware circuit re stores the clock signal to the
Power Manager. The Power Manager updates the time in the real-time
clock and checks the status of the system to determine whether to return the
Macintosh Portable to its operating state. The Power Manager checks for the
existence of the following conditions
A key on the keyboard has been pressed.
The wakeup timer is enabled and the time to which the wakeup timer
is set equals the time in the real-time clock.
An internal modem is installed, the user has activated the ring-detect
feature, and the modem has detected a ring (that is, someone has called
the modem).
Note that use of the mouse or trackball cannot be detected by the
Power Manager.
If the Power Manager does not detect any of these conditions, it deactivates
its own clock until the next rising edge of the 60 Hz clock signal. If the
Power Manager does detect one of these conditions, it re stores power to the
CPU, ROM, and any other hardware that was running when the computer
entered the sleep state. Then the Power Manager's wakeup procedure
reverses the procedure that put the Macintosh Portable into the sleep state,
including calling each routine listed in the sleep queue to allow it to re store
power to any sub systems it controls.